"""
边缘优化方法配置模块
"""

from typing import Dict, Any


class EdgeMethodConfig:
    """边缘优化方法配置类"""
    
    @staticmethod
    def get_methods() -> Dict[str, Any]:
        """
        获取所有优化方法配置
        
        Returns:
            Dict: 方法配置字典
        """
        return {
            "original": {
                "name": "原图",
                "description": "未经过边缘优化处理",
                "method": None
            },
            "feather": {
                "name": "羽化边缘",
                "description": "边缘渐变过渡，自然柔和",
                "method": "feather",
                "params": {"feather_amount": 15}
            },
            "feather_gaussian": {
                "name": "羽化+高斯",
                "description": "超柔和边缘，最佳融合",
                "method": "feather_gaussian",
                "params": {"feather_amount": 15, "blur_radius": 7}
            },
            "feather_gaussian_stroke": {
                "name": "羽化+高斯+描边",
                "description": "自动描边，增强边缘",
                "method": "feather_gaussian_stroke",
                "params": {"feather_amount": 15, "blur_radius": 7, "stroke_width": 2}
            },
            "choke": {
                "name": "收缩遮罩",
                "description": "去除白边和杂色",
                "method": "choke",
                "params": {"choke_amount": 2, "blur_radius": 3}
            },
            "decontaminate": {
                "name": "颜色去溢",
                "description": "净化边缘颜色污染",
                "method": "decontaminate",
                "params": {"edge_width": 5, "decontaminate_strength": 0.8}
            },
            "choke_decontaminate": {
                "name": "收缩+去溢",
                "description": "最强去白边效果",
                "method": "choke_decontaminate",
                "params": {"choke_amount": 1, "edge_width": 4, "decontaminate_strength": 0.7, "blur_radius": 3}
            },
            "guided_filter": {
                "name": "引导滤波",
                "description": "保边去噪，保留细节",
                "method": "guided_filter",
                "params": {"radius": 8, "eps": 0.01}
            },
            "custom_smooth_harden": {
                "name": "自定义调节⚙️",
                "description": "可调节平滑和硬化强度",
                "method": "custom_smooth_harden",
                "params": {"smooth_amount": 0.5, "harden_amount": 0.5},
                "adjustable": True  # 标记为可调节参数
            },
            "gaussian": {
                "name": "高斯模糊",
                "description": "快速平滑处理",
                "method": "gaussian",
                "params": {"blur_radius": 5}
            }
        }
    
    @staticmethod
    def get_method_order() -> list:
        """
        获取方法显示顺序
        
        Returns:
            list: 方法键名列表
        """
        return [
            "original", "feather", "feather_gaussian", "feather_gaussian_stroke",
            "choke", "decontaminate", "choke_decontaminate", "guided_filter",
            "custom_smooth_harden", "gaussian"
        ]

